#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <cstring>
#include <vector>
#include<queue>
using namespace std;
long long a[200005];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t, n, k;
	long long sum = 0;
	cin >> t;
	while (t--)
	{
		cin >> n >> k;
		for (int i = 1; i <= n; i++)
		{
			cin >> a[i];
			a[i] = a[i] + a[i - 1];
		}
		int l = 0, r = 0;
		while (l <= r && r <= n)
		{
			long long x = a[r] - a[l];
			if (x > k)
			{
				l++;
			}
			else if (x==k)
			{
				sum++;
				l++, r++;
			}
			else
			{
				r++;
			}
		}
		cout << sum << endl;
		sum = 0;
	}
	return 0;
}